<?php


Route::group(['prefix' => '', 'namespace' => 'Modules\Shop\Http\Controllers'], function () {

    $gets = [
        '/'                 => 'IndexController@getIndex',
        'category'          => 'CategoryController@getIndex',
        'api'               => 'ApiController@getIndex',
        'goods'             => 'GoodsController@getIndex',
        'affiche'           => 'AfficheController@getIndex',
        'article'           => 'ArticleController@getIndex',
        'article_cat'       => 'ArticleCatController@getIndex',
        'auction'           => 'AuctionController@getIndex',
        'brand'             => 'BrandController@getIndex',
        'captcha'           => 'CaptchaController@getIndex',
        'catalog'           => 'CatalogController@getIndex',
        'certi'             => 'CertiController@getIndex',
        'chinabank_receive' => 'ChinabankReceiveController@getIndex',
        'comment'           => 'CommentController@getIndex',
        'compare'           => 'CompareController@getIndex',
        'cycle_image'       => 'CycleImageController@getIndex',
        'exchange'          => 'ExchangeController@getIndex',
        'feed'              => 'FeedController@getIndex',
        'flow',
        'gallery',
        'goods_script',
        'group_buy',
        'messages',
        'myship',
        'package',
        'pick_out',
        'quotation',
        'receive',
        'region',
        'respond',
        'search',
        'sitemaps',
        'snatch',
        'tag_cloud',
        'topic',
        'user',
        'vote',
        'activity',


    ];
    foreach ($gets as $k => $v) {
        if (is_numeric($k)) {
            Route::get($v, str_replace(' ', '', ucwords(str_replace('_', ' ', $v))) . 'Controller@getIndex');
        } else {
            Route::get($k, $v);
        }
    }

    Route::post('category', 'CategoryController@postIndex');


    Route::any('{catchall}', function ($page) {
        // do something with $page
        //kd($page);
        App::make('Modules\Shop\Http\Controllers\IndexController')->getIndex();
    })->where('catchall', '(.*)');

    //Route::get('{page}/{subs}', [
    //    'uses' => 'IndexController@getIndex',
    //])->where(['page' => '^((?!admin).)*$', 'subs' => '.*']);

});